<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>获取父级数据属性</title>
  </head>
  <body>
    <!-- 模板声明 -->
    <template id="hello">
      <h1>{{msg}} {{user}}</h1>
    </template>

    <div id="app">
     <hello-component :user="user"></hello-component>
    </div>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.3/vue.js"></script>
    <script>
      Vue.component('hello-component', {
        template: '#hello',
        data: function () {
          return {
            msg: 'Hello'
          }
        },
        props: ['user']
      });

      new Vue({
        el: '#app',
        data: {
          user: 'hero'
        }
      });
    </script>
  </body>
</html>
